#ifndef __CARIOU_LINARD_LOADER_HH__
#define __CARIOU_LINARD_LOADER_HH__

#include "exception.h"
#include "film.h"
#include "camera.h"
#include "scene.h"

#include <sstream>
#include <iostream>


enum Lexem { unknow=0, start=1, eol=2, commentary=3, camera=4,
             sphere=5, light=6, color=7, plan=8, damier=9, texture=10,
             tore  = 11 , triangle = 12 , ambiantLight=13 , fog =14 };

class SceLoader
{
    public:

        double cameraInfos[8];

    protected:

        std::string  sceFile;
        Scene *      scene;
        unsigned int currentLineNumber;

        std::stringstream currentLine;
        Lexem             currentLexem;

        void getPoint(double &,double &,double &);
        void getColor(double &,double &,double &);

        void identifyMainLexem();
        void compileLine();

        void loadSphere();
        void loadPlan();
        void loadCamera();
        void loadLight();
        void loadDamier();
        void loadTexture();
        void loadTore();
        void loadTriangle();

        void loadAmbiantLight();
        void loadFOG();

    public:

        SceLoader();
        ~SceLoader();
        SceLoader(const SceLoader &);
        SceLoader& operator=(const SceLoader &);

        SceLoader(const std::string &, Scene *);

        void exec();


};

#endif
